Skip to content

🐛 Use today as workday when end_work crosses midnight into a new day - #38

Closed
amy-shinsen-openclaw wants to merge 1 commit into
mainfrom
fix/end-work-wrong-workday-crossing-midnight
Closed

🐛 Use today as workday when end_work crosses midnight into a new day#38
amy-shinsen-openclaw wants to merge 1 commit into
mainfrom
fix/end-work-wrong-workday-crossing-midnight

Conversation

@amy-shinsen-openclaw

Copy link
Copy Markdown
Collaborator

Root cause

When end_work is called after midnight (work started yesterday), the "yesterday" branch creates bridge annotations in today's file:

  • a StartWork at 00:00:00 with workday = yesterdaywrong
  • a StopWork at the current time with workday = yesterdaywrong

Because both carry yesterday's workday, they appear in the current month's stats as an extra worked day for yesterday — even though yesterday may belong to the previous month.

Fix

  • StartWork bridge at 00:00 now uses today as workday.
  • Final StopWork now uses today as workday when crossing midnight.

This ensures that annotations written into today's note file are correctly attributed to today in the stats.

Relationship to PR #37

PR #37 (fix/work-stats-extra-day) fixes the symptom by filtering out-of-month workdays from stats. This PR fixes the root cause by preventing the wrong workday from being written in the first place. Both are complementary.

@amy-shinsen-openclaw amy-shinsen-openclaw self-assigned this Jul 15, 2026
@gdarquie

Copy link
Copy Markdown
Contributor

No, this is not a bug but a feature 😁 When you work late because of different time period, what you do after midnight should be considered as the work day of "yesterday".

@gdarquie gdarquie closed this Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants